package bite;
import java.util.*;
/**
 * Creared with IntelliJ IDEA.
 * Description:【五子棋】NowCoder最近爱上了五子棋，现在给你一个棋局，请你帮忙判断其中有没有五子连珠（超过五颗也算）。
 * User:yxd
 * Date:2022-06-21
 * Time:23:00
 */
public class Day41_1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        char[][] nums = new char[20][20];
        while(input.hasNext()){
            for (int i = 0; i < 20; i++) {
                String str = input.next();
                for (int j = 0; j < 20; j++) {
                    nums[i][j] = str.charAt(j);
                }
            }
            boolean z = false;
            int[][] d = {{0,1},{1,0},{-1,0},{0,-1},{-1,-1},{1,-1},{-1,1},{1,1}};
            for (int i = 0; i < 20; i++) {
                for (int j = 0; j < 20; j++) {
                    if(nums[i][j] != '.'){
                        for (int k = 0; k < d.length; k++) {
                            int count = 0;
                            int x = d[k][0];
                            int y = d[k][1];
                            boolean flg = true;
                            while (count++ != 4){
                                int nx = x * count + i;
                                int ny = y * count + j;
                                if(nx < 0 || nx >= 20

                                        || ny < 0 || ny >= 20){
                                    flg = false;
                                    break;
                                }
                                if(nums[nx][ny] != nums[i][j]){
                                    flg = false;
                                    break;
                                }
                            }
                            if(flg){
                                z = true;
                                break;
                            }
                        }
                    }
                }
            }
            if(z){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
    }
}
